<!DOCTYPE html>












  


<html class="theme-next muse use-motion" lang="cn">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/>
<meta name="theme-color" content="#222">






  
  
    
      
    
    
      
    
  <script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
  <link href="//cdn.bootcss.com/pace/1.0.2/themes/blue/pace-theme-flash.min.css" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />



















  
  
  
  

  
    
    
  

  
    
      
    

    
  

  

  
    
      
    

    
  

  
    
      
    

    
  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic|Monda:300,300italic,400,400italic,700,700italic|Lobster Two:300,300italic,400,400italic,700,700italic|PT Mono:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






  

<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=6.4.0" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=6.4.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.4.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    version: '6.4.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="我流泪的时候，你也在流泪。我认为你没我孤独。我微笑的时候，你还在流泪。原来你比我寂寞。  python整数类型四种进制表示形式 十进制：1010,99，-217 二进制：以0b或0B开头：0b010，-0B101 八进制：以0o或0O开头：0o123，-0O456 十六进制：以0x或者0X开头：0x9a，-0X89">
<meta name="keywords" content="python">
<meta property="og:type" content="article">
<meta property="og:title" content="python数据类型">
<meta property="og:url" content="https://lengjibo.github.io/python数据类型/index.html">
<meta property="og:site_name" content="冷逸的个人博客|开往安河桥北~">
<meta property="og:description" content="我流泪的时候，你也在流泪。我认为你没我孤独。我微笑的时候，你还在流泪。原来你比我寂寞。  python整数类型四种进制表示形式 十进制：1010,99，-217 二进制：以0b或0B开头：0b010，-0B101 八进制：以0o或0O开头：0o123，-0O456 十六进制：以0x或者0X开头：0x9a，-0X89">
<meta property="og:locale" content="cn">
<meta property="og:image" content="https://img-blog.csdn.net/20180405093541257?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3VoZW5nMjAxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70">
<meta property="og:image" content="https://img-blog.csdn.net/20180419130201897?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhvdWhlbmcyMDE4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast">
<meta property="og:image" content="https://img-blog.csdn.net/20180405100200343?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3VoZW5nMjAxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70">
<meta property="og:image" content="https://img-blog.csdn.net/20180405100826559?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3VoZW5nMjAxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70">
<meta property="og:image" content="https://img-blog.csdn.net/20180405101430718?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3VoZW5nMjAxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70">
<meta property="og:image" content="https://img-blog.csdn.net/20180405103052296?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3VoZW5nMjAxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70">
<meta property="og:image" content="https://img-blog.csdn.net/20180405110808439?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3VoZW5nMjAxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70">
<meta property="og:updated_time" content="2018-08-19T12:18:22.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="python数据类型">
<meta name="twitter:description" content="我流泪的时候，你也在流泪。我认为你没我孤独。我微笑的时候，你还在流泪。原来你比我寂寞。  python整数类型四种进制表示形式 十进制：1010,99，-217 二进制：以0b或0B开头：0b010，-0B101 八进制：以0o或0O开头：0o123，-0O456 十六进制：以0x或者0X开头：0x9a，-0X89">
<meta name="twitter:image" content="https://img-blog.csdn.net/20180405093541257?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3VoZW5nMjAxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70">



  <link rel="alternate" href="/../../.deploy_git/atom.xml" title="冷逸的个人博客|开往安河桥北~" type="application/atom+xml" />




  <link rel="canonical" href="https://lengjibo.github.io/python数据类型/"/>



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>python数据类型 | 冷逸的个人博客|开往安河桥北~</title>
  









  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="cn">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">冷逸的个人博客|开往安河桥北~</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="Toggle navigation bar">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br />Startseite</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-about">
    <a href="/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br />Über</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">
    <a href="/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />Tags</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">
    <a href="/categories/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-th"></i> <br />Kategorien</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />Archiv</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-book">
    <a href="/book/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-book"></i> <br />book</a>
  </li>

      
      
    </ul>
  

  
    

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://lengjibo.github.io/python数据类型/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="冷逸">
      <meta itemprop="description" content="做一个温柔的人...">
      <meta itemprop="image" content="http://ww1.sinaimg.cn/large/007F8GgBly1g7vony4ltaj308w08wq30.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="冷逸的个人博客|开往安河桥北~">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">python数据类型
              
            
          </h1>
        

        <div class="post-meta">
        
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Veröffentlicht am</span>
              

              
                
              

              <time title="Post created: 2018-08-19 16:10:03 / Updated at: 20:18:22" itemprop="dateCreated datePublished" datetime="2018-08-19T16:10:03+08:00">2018-08-19</time>
            

            
              

              
            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">in</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/python/" itemprop="url" rel="index"><span itemprop="name">python</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="post-meta-item-icon"
            >
            <i class="fa fa-eye"></i>
             Views:  
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>我流泪的时候，你也在流泪。我认为你没我孤独。<br>我微笑的时候，你还在流泪。原来你比我寂寞。</p>
<hr>
<h1 id="python整数类型"><a href="#python整数类型" class="headerlink" title="python整数类型"></a>python整数类型</h1><h3 id="四种进制表示形式"><a href="#四种进制表示形式" class="headerlink" title="四种进制表示形式"></a>四种进制表示形式</h3><ul>
<li>十进制：1010,99，-217</li>
<li>二进制：以0b或0B开头：0b010，-0B101</li>
<li>八进制：以0o或0O开头：0o123，-0O456</li>
<li>十六进制：以0x或者0X开头：0x9a，-0X89</li>
</ul>
<a id="more"></a>
<h3 id="python浮点数类型"><a href="#python浮点数类型" class="headerlink" title="python浮点数类型"></a>python浮点数类型</h3><p>浮点数之间的运算存在不确定尾数，不是bug</p>
<p>比如0.1+0.20.30000000000000004</p>
<p>解决方法：round(x,d):对x四舍五入，d是小数截取位数</p>
<p>关于round的坑：<br><a href="http://www.runoob.com/w3cnote/python-round-func-note.html" target="_blank" rel="noopener">http://www.runoob.com/w3cnote/python-round-func-note.html</a></p>
<h3 id="表示方法之科学计数法："><a href="#表示方法之科学计数法：" class="headerlink" title="表示方法之科学计数法："></a>表示方法之科学计数法：</h3><p>使用字母e或E作为幂的符号</p>
<p><a>e<b> 表示a*10b次方</b></a></p>
<p>如4.3e-3的值为0.0043</p>
<h3 id="python负数类型"><a href="#python负数类型" class="headerlink" title="python负数类型"></a>python负数类型</h3><p>若x的平方-1，哪x的值是多少？<br>所以定义j根号下-1，以此为基础构造负数<br>a+bj称为负数，a是实部，b是虚部</p>
<p>实例：z1.2e-4+5.6e+89j</p>
<p>z.real  获取实部<br>z.imag  获取虚部</p>
<h3 id="python运算操作符"><a href="#python运算操作符" class="headerlink" title="python运算操作符"></a>python运算操作符</h3><p>+、-、*、/、//(整除)、%(模除)、**(幂运算，为小数是开放运算)</p>
<p>二元操作</p>
<p>+、-、/、*</p>
<h3 id="数字类型之间的关系"><a href="#数字类型之间的关系" class="headerlink" title="数字类型之间的关系"></a>数字类型之间的关系</h3><p>类型间可以混合运算，生成结果为最宽的</p>
<p>整数-&gt;浮点数-&gt;负数</p>
<p>如：123+4.0127.0</p>
<h3 id="部分python函数"><a href="#部分python函数" class="headerlink" title="部分python函数"></a>部分python函数</h3><p>abs(x)  取绝对值<br>divmod(x,y)  商余，(x//y,x%y)同时输出商和余数<br>如divmod(10,3) 输出3,1<br>pow(x,y[,z]) 幂余，(x**y)%z,[..]表示参数z可省略<br>max(a,b,c…) 判断其中的最大值<br>min(a,b,c…) 判断其中的最小值<br>int(x) 将x变成整数<br>float(x) 将x变成浮点数</p>
<h3 id="小程序："><a href="#小程序：" class="headerlink" title="小程序："></a>小程序：</h3><pre><code>
up=1.0
day=0.01
for i in range(365):
    if i % 7 in [6,0]:
        up  up*(1-day)
    else:
        up  up*(1+day)
print("最终是：{:.2f}".format(up))  
</code></pre>



<h1 id="python字符串类型"><a href="#python字符串类型" class="headerlink" title="python字符串类型"></a>python字符串类型</h1><p>-由一对单引号或双引号表示，仅表示单行字符<br>-由一对三引号或三双引号表示，可表示多行字符</p>
<p>字符串包含单引号或者双引号</p>
<p>‘这有个双引号”哈哈哈’<br>“这有个单引号’哈哈哈”</p>
<h3 id="字符串操作："><a href="#字符串操作：" class="headerlink" title="字符串操作："></a>字符串操作：</h3><p>使用[]获取字符串中的一个或多个字符</p>
<p><img src="https://img-blog.csdn.net/20180405093541257?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3VoZW5nMjAxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""></p>
<h4 id="索引："><a href="#索引：" class="headerlink" title="索引："></a>索引：</h4><p>返回字符串中单个字符  &lt;字符串&gt;[M]<br>如 “temp：”[0]  返回‘t’</p>
<h4 id="切片："><a href="#切片：" class="headerlink" title="切片："></a>切片：</h4><p>返回字符串中一段字符子串 &lt;字符串&gt;[M:N]</p>
<p>如 “temp”[1:3] 返回 ‘em’</p>
<h4 id="切片高级用法"><a href="#切片高级用法" class="headerlink" title="切片高级用法"></a>切片高级用法</h4><p>&lt;字符串&gt;[M:N:K],根据步长k对字符串进行切片<br>表示从第一个字符开始截取，间隔k个字符取一个。</p>
<p>如”一二三四五六七八九十”[1:8:2] 返回’二四六八’<br>如”一二三四五六七八九十”[::-1] 返回’十九八七六五四三二一’</p>
<h3 id="转义符"><a href="#转义符" class="headerlink" title="转义符"></a>转义符</h3><p>表达特殊含义</p>
<p><img src="https://img-blog.csdn.net/20180419130201897?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhvdWhlbmcyMDE4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""></p>
<pre><code>
>>> "\""
'"'

>>> r'D:\Program Files (x86)\Python35-32'
'D:\\Program Files (x86)\\Python35-32'


>>> 'D:\Program Files (x86)\Python35-32'
'D:\\Program Files (x86)\\Python35-32' 
</code></pre>




<h3 id="字符串操作符"><a href="#字符串操作符" class="headerlink" title="字符串操作符"></a>字符串操作符</h3><p><img src="https://img-blog.csdn.net/20180405100200343?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3VoZW5nMjAxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""></p>
<pre><code>
>>> 'a'+'b'
'ab'
>>> 's'*2
'ss'
>>> 'x' in 'xs'
True
>>> 
</code></pre>





<h3 id="字符串操作函数"><a href="#字符串操作函数" class="headerlink" title="字符串操作函数"></a>字符串操作函数</h3><p><img src="https://img-blog.csdn.net/20180405100826559?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3VoZW5nMjAxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""></p>
<pre><code>
   >>> for i in range(12):
    print(chr(9800 + i), end",")


♈,♉,♊,♋,♌,♍,♎,♏,♐,♑,♒,♓,

</code></pre>




<h3 id="字符串操作方法"><a href="#字符串操作方法" class="headerlink" title="字符串操作方法"></a>字符串操作方法</h3><p><img src="https://img-blog.csdn.net/20180405101430718?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3VoZW5nMjAxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""></p>
<h4 id="str-strip-chars-rm-详解"><a href="#str-strip-chars-rm-详解" class="headerlink" title="str.strip( chars_rm ) 详解"></a>str.strip( chars_rm ) 详解</h4><p>（1）声明：str 为字符串，chars_rm为要删除的字符序列<br>（2）细分</p>
<blockquote>
<p>str.strip(chars_rm)     # 删除s字符串开头、结尾处，位于rm删除序列中的字符<br>str.lstrip(chars_rm)    # 删除s字符串开头处，位于rm删除序列中的字符<br>str.rstrip(chars_rm)    # 删除s字符串结尾处，位于rm删除序列中的字符</p>
</blockquote>
<p>（3）注意：</p>
<p>1）当chars_rm为空时，默认删除空白符（包括’\n’, ‘\r’, ‘\t’, ‘ ‘)<br>2）只要边（开头或结尾）上的字符在删除序列chars_rm内，就删除掉。</p>
<p>（4）例如</p>
<pre><code>
>>> ' 78ihvyf \n'.strip()
'78ihvyf'
</code></pre>

<h4 id="str-join-iter-详解"><a href="#str-join-iter-详解" class="headerlink" title="str.join( iter ) 详解"></a>str.join( iter ) 详解</h4><p>  (1）语法： ‘sep’.join(iter)：以sep作为分隔符，将seq所有的元素合并成一个新的字符串</p>
<p>（2）参数说明<br>sep：分隔符（字符串），可以为空。<br>iter：要连接的元素序列、字符串、元组、字典（可迭代对象）</p>
<p>（3）返回值：返回一个以分隔符sep连接各个元素后生成的字符串</p>
<pre><code>
# 字符列表转字符串
>>> ''.join(['e', 't', 'fff13fff', 'k', '.', 'h', 'l'])
'etfff13fffk.hl'
</code></pre>

<h4 id="end-字符串所有方法"><a href="#end-字符串所有方法" class="headerlink" title="end 字符串所有方法"></a>end 字符串所有方法</h4><pre><code>
     >>> dir(str)
</code></pre>

<h3 id="字符串的格式化"><a href="#字符串的格式化" class="headerlink" title="字符串的格式化"></a>字符串的格式化</h3><p>字符串格式化使用.format()方法，用法如下：<br>    &lt;模板字符串&gt;.format(&lt;逗号分隔的参数&gt;)<br>槽<br>例子</p>
<pre><code>
>>> "{}:计算机{}的CPU占用率为{}%".format("1949-10-1","CHA",10)
'1949-10-1:计算机CHA的CPU占用率为10%'
</code></pre>

<p><img src="https://img-blog.csdn.net/20180405103052296?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3VoZW5nMjAxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""></p>
<p>format()方法的格式控制 </p>
<p><img src="https://img-blog.csdn.net/20180405110808439?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3VoZW5nMjAxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" alt=""></p>
<p>例子</p>
<pre><code>
>>> "{0:=^20}".format("0123456789")
'=====0123456789====='

>>> "{0:e}；{0:,.2f}；{0:,%}" . format(123.1415926)
'1.231416e+02；123.14；12,314.159260%'

# 使用 {{}} 输出 {}
>>> a = 123.141592
>>> b = 'ABCDEF'
>>> print( "{{}}{0:e},{1:=^10},{0:.2f}".format(a, b) )      
{}1.231416e+02,==ABCDEF==,123.14
# ':'号前面的数字为 参数序号
</code></pre>

<p>A.format(X)方法是字符串的方法，操作完了得到的也是字符串。但是X可以是数字或者字符串。<br>{}里面的标点必须是英文标点符号。</p>

      
    </div>

    

    
    
    

    <div>
      
        
<div class="my_post_copyright">
  <script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>
  
  <!-- JS库 sweetalert 可修改路径 -->
  <script src="https://cdn.bootcss.com/jquery/2.0.0/jquery.min.js"></script>
  <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
  <p><span>本文标题:</span><a href="/python数据类型/">python数据类型</a></p>
  <p><span>文章作者:</span><a href="/" title="访问 冷逸 的个人博客">冷逸</a></p>
  <p><span>发布时间:</span>2018年08月19日 - 16:08</p>
  <p><span>最后更新:</span>2018年08月19日 - 20:08</p>
  <p><span>原始链接:</span><a href="/python数据类型/" title="python数据类型">https://lengjibo.github.io/python数据类型/</a>
    <span class="copy-path"  title="点击复制文章链接"><i class="fa fa-clipboard" data-clipboard-text="https://lengjibo.github.io/python数据类型/"  aria-label="复制成功！"></i></span>
  </p>
  <p><span>许可协议:</span><i class="fa fa-creative-commons"></i> <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
</div>
<script> 
    var clipboard = new Clipboard('.fa-clipboard');
    $(".fa-clipboard").click(function(){
      clipboard.on('success', function(){
        swal({   
          title: "",   
          text: '复制成功',
          icon: "success", 
          showConfirmButton: true
          });
    });
    });  
</script>


      
    </div>
    <div>
      
        <div>
    
        <div style="text-align:center;color: #555;font-size:14px;">-------------The End-------------</div>
    
</div>

      
    </div>
    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>Donate</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/wechat.png" alt="冷逸 WeChat Pay"/>
        <p>WeChat Pay</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/zhifubao.jpg" alt="冷逸 Alipay"/>
        <p>Alipay</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/python/" rel="tag"><i class="fa fa-tag"></i> python</a>
          
        </div>
      

      
      
        <div class="post-widgets">
        

        

        
          
          <div class="social_share">
            
               <div>
                 
  <div class="bdsharebuttonbox">
    <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
    <a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a>
    <a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a>
    <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
    <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
    <a href="#" class="bds_tieba" data-cmd="tieba" title="分享到百度贴吧"></a>
    <a href="#" class="bds_twi" data-cmd="twi" title="分享到Twitter"></a>
    <a href="#" class="bds_fbook" data-cmd="fbook" title="分享到Facebook"></a>
    <a href="#" class="bds_more" data-cmd="more"></a>
    <a class="bds_count" data-cmd="count"></a>
  </div>
  <script>
    window._bd_share_config = {
      "common": {
        "bdText": "",
        "bdMini": "2",
        "bdMiniList": false,
        "bdPic": ""
      },
      "share": {
        "bdSize": "16",
        "bdStyle": "0"
      },
      "image": {
        "viewList": ["tsina", "douban", "sqq", "qzone", "weixin", "twi", "fbook"],
        "viewText": "分享到：",
        "viewSize": "16"
      }
    }
  </script>

<script>
  with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='//bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>

               </div>
            
            
          </div>
        
        </div>
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/python语言turtle的使用/" rel="next" title="python语言turtle的使用">
                <i class="fa fa-chevron-left"></i> python语言turtle的使用
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/安全面试题整理/" rel="prev" title="安全面试题整理">
                安全面试题整理 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            Inhaltsverzeichnis
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            Übersicht
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="http://ww1.sinaimg.cn/large/007F8GgBly1g7vony4ltaj308w08wq30.jpg"
                alt="冷逸" />
            
              <p class="site-author-name" itemprop="name">冷逸</p>
              <p class="site-description motion-element" itemprop="description">做一个温柔的人...</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">113</span>
                    <span class="site-state-item-name">Artikel</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">19</span>
                    <span class="site-state-item-name">Kategorien</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">120</span>
                    <span class="site-state-item-name">Tags</span>
                  </a>
                </div>
              
            </nav>
          

          
            <div class="feed-link motion-element">
              <a href="/../../.deploy_git/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  <a href="https://github.com/lengjibo" target="_blank" title="GitHub"><i class="fa fa-fw fa-globe"></i>GitHub</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="qqlengyi@163.com" target="_blank" title="E-Mail"><i class="fa fa-fw fa-globe"></i>E-Mail</a>
                  
                </span>
              
            </div>
          
        <div id="music163player">
            <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=110 src="https://music.163.com/outchain/player?type=0&id=377079922&auto=1&height=90"></iframe>
          </div>
          
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                友情链接
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="https://sqlmap.wiki/" title="青春's blog" target="_blank">青春's blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://www.addon.pub/" title="Yokeen's blog" target="_blank">Yokeen's blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://freeerror.org/" title="之乎者也's blog" target="_blank">之乎者也's blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.bugbank.cn/team/FrigidSword" title="漏洞银行" target="_blank">漏洞银行</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.vulbox.com/team/Frigid%20Sword%E5%AE%89%E5%85%A8%E5%9B%A2%E9%98%9F" title="漏洞盒子" target="_blank">漏洞盒子</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://godpang.github.io/" title="Mr.赵" target="_blank">Mr.赵</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://amliaw4.github.io/" title="amliaW4'S Blog" target="_blank">amliaW4'S Blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.se7ensec.cn/" title="se7en's Blog" target="_blank">se7en's Blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://ninjia.gitbook.io/secskill/" title="secskill" target="_blank">secskill</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://www.bug1024.cn/" title="ibug" target="_blank">ibug</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://wwcx.org/" title="Strjziny's Blog" target="_blank">Strjziny's Blog</a>
                  </li>
                
              </ul>
            </div>
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#python整数类型"><span class="nav-number">1.</span> <span class="nav-text">python整数类型</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#四种进制表示形式"><span class="nav-number">1.0.1.</span> <span class="nav-text">四种进制表示形式</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#python浮点数类型"><span class="nav-number">1.0.2.</span> <span class="nav-text">python浮点数类型</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#表示方法之科学计数法："><span class="nav-number">1.0.3.</span> <span class="nav-text">表示方法之科学计数法：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#python负数类型"><span class="nav-number">1.0.4.</span> <span class="nav-text">python负数类型</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#python运算操作符"><span class="nav-number">1.0.5.</span> <span class="nav-text">python运算操作符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#数字类型之间的关系"><span class="nav-number">1.0.6.</span> <span class="nav-text">数字类型之间的关系</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#部分python函数"><span class="nav-number">1.0.7.</span> <span class="nav-text">部分python函数</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#小程序："><span class="nav-number">1.0.8.</span> <span class="nav-text">小程序：</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#python字符串类型"><span class="nav-number">2.</span> <span class="nav-text">python字符串类型</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#字符串操作："><span class="nav-number">2.0.1.</span> <span class="nav-text">字符串操作：</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#索引："><span class="nav-number">2.0.1.1.</span> <span class="nav-text">索引：</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#切片："><span class="nav-number">2.0.1.2.</span> <span class="nav-text">切片：</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#切片高级用法"><span class="nav-number">2.0.1.3.</span> <span class="nav-text">切片高级用法</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#转义符"><span class="nav-number">2.0.2.</span> <span class="nav-text">转义符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#字符串操作符"><span class="nav-number">2.0.3.</span> <span class="nav-text">字符串操作符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#字符串操作函数"><span class="nav-number">2.0.4.</span> <span class="nav-text">字符串操作函数</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#字符串操作方法"><span class="nav-number">2.0.5.</span> <span class="nav-text">字符串操作方法</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#str-strip-chars-rm-详解"><span class="nav-number">2.0.5.1.</span> <span class="nav-text">str.strip( chars_rm ) 详解</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#str-join-iter-详解"><span class="nav-number">2.0.5.2.</span> <span class="nav-text">str.join( iter ) 详解</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#end-字符串所有方法"><span class="nav-number">2.0.5.3.</span> <span class="nav-text">end 字符串所有方法</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#字符串的格式化"><span class="nav-number">2.0.6.</span> <span class="nav-text">字符串的格式化</span></a></li></ol></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2014 – <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">冷逸</span>

  

  
</div>




  <div class="powered-by">Erstellt mit  <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> v3.7.1</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme – <a class="theme-link" target="_blank" href="https://theme-next.org">NexT.Muse</a> v6.4.0</div>






        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv" title="Total Visitors">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  

  
    <span class="site-pv" title="Total Views">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>














  







  
  







  
  
    <script type="text/javascript" src="//cdn.jsdelivr.net/jquery/2.1.3/jquery.min.js"></script>
  

  
  
    <script type="text/javascript" src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.min.js"></script>
  

  
  
    <script type="text/javascript" src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.ui.min.js"></script>
  

  
  
    <script type="text/javascript" src="//cdn.bootcss.com/canvas-nest.js/1.0.1/canvas-nest.min.js"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/three.min.js"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/canvas_sphere.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.4.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.4.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.4.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.4.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.4.0"></script>



  



  










  





  

  

  

  

  
  

  

  

  

  

  

<script src="/live2dw/lib/L2Dwidget.min.js?0c58a1486de42ac6cc1c59c7d98ae887"></script><script>L2Dwidget.init({"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>
<script type="text/javascript" src="/js/src/love.js"></script>
